<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var re = /abc/i;
var s = "Abcac";
console.log(re.lastIndex);

var res = re.test(s);
console.log(re.lastIndex);
// 每匹配一次之后, 正则表达式内部就有一个属性表示下次匹配的起始位置
console.log(res);
console.log(re.test(s));
console.log(re.lastIndex);
console.log(re.test(s));
console.log(re.test(s));
</script>
</body>
</html>